If the current page is removed, always pick a different one. (#392457,
authorMatthias Clasen <mclasen@redhat.com>
Wed, 3 Jan 2007 20:40:30 +0000 (20:40 +0000)
committerMatthias Clasen <matthiasc@src.gnome.org>
Wed, 3 Jan 2007 20:40:30 +0000 (20:40 +0000)
2007-01-03  Matthias Clasen  <mclasen@redhat.com>

        * gtk/gtkassistant.c (remove_page): If the current page
        is removed, always pick a different one.  (#392457,
        Colin Watson)

svn path=/trunk/; revision=17037

ChangeLog
gtk/gtkassistant.c

index f51c9bf7f4b3db212d78881775dd75b13cc79a19..0188d047bc776ea6d5ca5cbe5d6ae6f1a548e073 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2007-01-03  Matthias Clasen  <mclasen@redhat.com>
+
+       * gtk/gtkassistant.c (remove_page): If the current page
+       is removed, always pick a different one.  (#392457, 
+       Colin Watson)
+
 2007-01-03  Matthias Clasen  <mclasen@redhat.com>
 
        * modules/printbackend/cups/*.c: Coding style cleanups.
index 4dc89885bfd52aea7a5f94322b88e5157b6caa49..49a519dba77da4d9e9746c90df212b9f47c09f0c 100644 (file)
@@ -849,12 +849,29 @@ remove_page (GtkAssistant *assistant,
 {
   GtkAssistantPrivate *priv = assistant->priv;
   GtkAssistantPage *page_info;
+  GList *page_node;
 
   page_info = element->data;
 
-  /* If we are mapped and visible, we want to deal with changing the page. */
-  if ((GTK_WIDGET_MAPPED (page_info->page)) && (page_info == priv->current_page))
-    compute_next_step (assistant);
+  /* If this is the current page, we need to switch away. */
+  if (page_info == priv->current_page)
+    {
+      if (!compute_next_step (assistant))
+        {
+         /* The best we can do at this point is probably to pick the first
+          * visible page.
+          */
+         page_node = priv->pages;
+
+         while (page_node && !GTK_WIDGET_VISIBLE (((GtkAssistantPage *) page_node->data)->page))
+           page_node = page_node->next;
+
+         if (page_node)
+           priv->current_page = page_node->data;
+         else
+           priv->current_page = NULL;
+        }
+    }
 
   priv->pages = g_list_remove_link (priv->pages, element);
   priv->visited_pages = g_slist_remove_all (priv->visited_pages, page_info);